<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<%
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
<html>
  <head>
    <base href="<%=basePath%>">  
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<link rel="stylesheet" type="text/css" href="css/edittable.css"  ></link>
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript"  src="js/jquery-1.8.0.js"></script>
	<script>
		$(function(){
			$("input[type=reset]").click(function(){
				$("#checked").attr("checked","checked");
			});
			
			$("input[type=submit]").click(function(){
				if(confirm("确认要提交吗")){
					var _roleId = $("input[type=radio]:checked").val();
					var _id=${adminInfo.id};
					$.ajax({
						url:"RoleServlet.do",
						type:"post",
						data:{roleId:_roleId,id:_id,flag:"genggai"},
						success:function(dat){
							alert(dat);
						}
					});
				}
			});
		});
	</script>
  </head>
  	<div class ="div_title">
		 <div class="div_titlename"> <img src="images/san_jiao.gif" ><span>更改用户角色</span></div>
	 </div>
	  <body>
	   <table class="edit_table" >
	   <tr>
	   <td class="td_info">  用户账号：</td>
	   <td><input type="text" value="${adminInfo.adminName }" disabled="disabled"/> </td>
	   </tr>
		<tr>
			<td class="td_info">用户角色:</td>
			<td >
			   	<c:forEach var="roleInfo" items="${roleInfo }">
				   	<c:choose>
				   		<c:when test="${adminInfo.roleId==roleInfo.id }">
				   			<input type="radio" value="${roleInfo.id }" name="roleName" checked="checked" id="checked"/>${roleInfo.roleName }<br/>
				   		</c:when>
				   		<c:otherwise>
				   			<input type="radio" value="${roleInfo.id }" name="roleName"/>${roleInfo.roleName }<br/>
				   		</c:otherwise>
				   	</c:choose>
				</c:forEach>
			</td>
		</tr>
		<tr>
			<td class="td_info"> </td>	
 			<td> 
				<input class="form_btn" type="submit" value="提交" /> 
				<input type="reset"  class="form_btn" value="重置" />
			</td>	
		</tr>
		
	   </table>
		   
		
		
	  </body>
</html>